package com.fly.easy.queue;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

import com.fly.easy.queue.common.MessageEntity;
import com.fly.easy.queue.croe.FlyClient;
import com.fly.easy.queue.utils.ThreadUtil;

/**
 * test
 *
 */
public class App {
	public static FlyClient c=new FlyClient();
	public static void main(String[] args) {
		List<String>handleClassName=new ArrayList<>();
		handleClassName.add("com.fly.easy.queue.common.SimpleMssageHandle");
		handleClassName.add("com.fly.easy.queue.common.SimpleMssageHandle2");
		c.setHandleClassName(handleClassName);
		c.init();
		send();
		//ThreadUtil.sleep(50000);
		
		
	    while (true) {
	    	int send=new Scanner(System.in).nextInt();
	    	if(send==1)send();
	    }

	}

	public static void send() {
		long b=System.currentTimeMillis();
		for (int i = 0; i < 500000; i++) {
			MessageEntity entity = new MessageEntity("com.fly.easy.queue.common.SimpleMssageHandle",
					"hello" + i);
			MessageEntity entity2 = new MessageEntity("com.fly.easy.queue.common.SimpleMssageHandle2",
					"yoxi" + i);
			c.synSend(entity);
			c.synSend(entity2);
			//ThreadUtil.sleep(10);
		}
		long e=System.currentTimeMillis();
		System.out.println("发送完成"+(e-b)+"毫秒");
		System.out.println("end...................");
	}
}
